import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { ObjCreate } from "../common/ObjCreate";
import { GangFightsChangeCaptainCellRenderer } from "./cellRenderer/GangFightsChangeCaptainCellRenderer";
import { SGangFightsTeamInfo } from "../../../../Message/Public/SGangFightsTeamInfo";
import { Cache } from "../../cache/Cache";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { GTileList } from "../../../../com/mui/controls/GTileList";
import { GButton } from "../../../../com/mui/controls/GButton";
//class GangFightsChangeCaptainWindow
    
    export  class GangFightsChangeCaptainWindow extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(323, 188);
            title = Language.getString(44453);
            titleHeight = 26;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(18, 38, 287, 101, this);
            this._tileList = ObjCreate.createTileList(28, 47, 273, 80, this);
            this._tileList.columnWidth = 273;
            this._tileList.rowHeight = 40;
            this._tileList.setStyle("cellRenderer", GangFightsChangeCaptainCellRenderer);
            this._btnOK = ObjCreate.createGButton(Language.getString(44454), 126, 148, 70, 26, this);
            this._btnOK.addEventListener(flash.events.MouseEvent.CLICK, this.onClickBtnOK);
            return;
        }

        /* internal  */onClickBtnOK(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        public updateTeamInfo(arg1: SGangFightsTeamInfo): void
        {
            var loc2=null;
            var loc1=[];
            var loc3=0;
            var loc4=arg1.members;
            for(loc2 of loc4) 
            {
                if (loc2.name == Cache.instance.role.entityInfo.name) 
                {
                    continue;
                }
                loc1.push(loc2);
            }
            this._tileList.dataProvider = new DataProvider(loc1);
            this._tileList.drawNow();
            return;
        }

        public static get instance(): GangFightsChangeCaptainWindow
        {
            if (!GangFightsChangeCaptainWindow._instance) 
            {
                GangFightsChangeCaptainWindow._instance = new GangFightsChangeCaptainWindow();
            }
            return GangFightsChangeCaptainWindow._instance;
        }

        public static hasInstance(): Boolean
        {
            return !(GangFightsChangeCaptainWindow._instance == null);
        }

        /* internal */ /* var */_tileList: GTileList;

        /* internal */ /* var */_btnOK: GButton;

        /* internal */ static /* var */_instance: GangFightsChangeCaptainWindow;
    }
